<?php
namespace App\Http\Controllers\Api;


use App\Models\AppProtocolModel;
use Framework\BaseController;
use Illuminate\Http\Request;

class AppProtocolController extends BaseController
{
    public function getAppProtocolList()
    {
        $res = AppProtocolModel::query()->get();
        $this->retSuccess($res);
    }

    public function getAppProtocolInfo(Request $request)
    {

        $query = AppProtocolModel::query();

        $id = $request->input('id');
        $type = $request->input('type');
        $type_name = $request->input('type_name');

        if($id){
            $query->where('id', $id);
        }else if($type){
            $query->where('type', $id);
        }else if($type_name){
            $query->where('type_name', $type_name);
        }else{
            $this->retError('缺少查询参数');
        }

        $res = $query->first();
        $this->retSuccess($res);
    }

}
